<html>
<head>
	<meta charset="UTF-8">
	<title>批次配置窗口</title>
	<link id="easyuiTheme" href="../../static/easyui/themes/bootstrap/easyui.css" rel="stylesheet" type="text/css"/>
	<link href="../../static/easyui/themes/frameless.css" rel="stylesheet" type="text/css"/>
	<script src="../../static/easyui/jquery.min.js" type="text/javascript"></script>
	<script src="../../static/easyui/jquery.cookie.js" type="text/javascript"></script>
	<script src="../../static/plugin/assets/jslib.easyui.util.js" type="text/javascript"></script>
	<script src="../../ffres/dict/all.js" type="text/javascript"></script>
	<link href="../../static/easyui/themes/icon.css" rel="stylesheet" type="text/css"/>
	<script src="../../static/easyui/ui-theme.js" type="text/javascript"></script>
	<script src="../../static/easyui/jquery.easyui.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../static/easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
	<script src="../../static/plugin/assets/jslib.util.js" type="text/javascript"></script>
	<script src="../../static/plugin/assets/jslib.jquery.ajax.js" type="text/javascript"></script>
	<a href="" target="_blank" id="commonLink" name="commonLink"></a>
	<style type="text/css"></style>
	<script type="text/javascript">

		$(function(){
			var params = JLEUtil.paramUrl2Obj(window.location.href);
			var batchId = params.batchId;
			$.restfulPostForm('../../api/bat/batch/stage/configs',{batchId: params.batchId},function(data){
				if(data.rows.length>0){
					var jsonTree=[{text: params.batchName,name:'',value:'', state: 'open'}];
					for(var i=0;i<data.rows.length;i++){
						data.rows[i].text=data.rows[i].stageName;
						data.rows[i].value=data.rows[i].stageId;
					}
					jsonTree[0].children=data.rows;
					$("#tt").tree({
						data:jsonTree,
						onClick: function(node){
							if(node.value != "" && node.value != null){
							addTab(node.text,'BatTaskUnitConfigList.html?batchId='+batchId+"&stageId="+node.value);
							}
						}
					});
					var nodes=$("#tt li ul li").find("div")[0].click();
				} else{
					$.messager.alert('提示','当前批次阶段配置为空！','info');
				}
			});
		});

		function addTab(title, url){
			if ($('#tab').tabs('exists', title)){
				$('#tab').tabs('select', title);
			} else {
				var content = '<iframe scrolling="auto" frameborder="0" src="'+url+'" style="width:100%;height:100%;"></iframe>';
				$('#tab').tabs('add',{
					title:title,
					content:content,
					closable:true
				});
			}
		}

	</script>
</head>
<body class="easyui-layout">
<div data-options="region:'west',title:'批次阶段信息'" style="width:270px;padding:1px;">
	<ul id="tt" class="easyui-tree"data-options="animate:true,lines:true">
	</ul>
</div>
<div data-options="region:'center',title:''" >
	<div class="easyui-panel" data-options="region:'center', border:'false'" style="height:99%">
		<div id="tab" class="easyui-tabs" fit="true" border="false" style="width:100%;height:95%">

		</div>
	</div>
</div>
</body>
</html>
